

function ajaxFun(type, url, isAsyn, data, callBack) {
    let xhr = new XMLHttpRequest();

    type = type.toLowerCase();

    if (type == "get") {
        let urlParam = url;

        if (data != "") {
            urlParam += "?" + data;
        }
        xhr.open(type, urlParam, isAsyn);
        xhr.send();
    } else {
        xhr.open(type, url, isAsyn);
        xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        xhr.send(data);
    }

    xhr.onreadystatechange = function() {
        if (xhr.readyState == 4 && xhr.status == 200) {
            callBack(xhr.responseText);
        }
    }
}